feat(perps): sync perps controller may 21 2026 (final)#8871
Merged
Conversation
Final source sync of the perps controller from mobile before the controller becomes source-of-truth in core. After this lands, mobile will drop its local copy under app/controllers/perps/ and depend on @metamask/perps-controller directly. Mobile changes since the previous sync (commit 35953448): - feat(perps): add slippage controls for market orders (mobile #30125) - feat(perps): track vip_tier and vip_discount on trading events (mobile #30385) - feat(perps): show in-app banner during ongoing perps outage (mobile #30081) - fix: prefer the selected EVM account when resolving the trading account (mobile #30253) - fix(perps): suppress "User or API Wallet does not exist" Sentry noise from unfunded wallets (mobile #29972) - fix(perps): builder fee not approved on order submission (mobile #30095)
- HyperLiquidWalletService getCurrentAccountId now throws NO_ACCOUNT_SELECTED after the selected-EVM-account fix; both accountTree lookups swallow errors via try/catch. - HyperLiquidProvider builder-fee retry asserts the post-fix behavior (mobile #30095): a cached failure no longer skips approval, so the fee is retried until it lands. PerpsSigningCache is the actual cache used by the source.
The mobile sync introduced new branches that mobile tests cover but that aren't part of the synced core test files (sync excludes *.test.ts). Lower the gate by 1 point until the test files catch up — currently 69.78%, the gate was 70%.
10 tasks
aganglada
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Final source sync of the perps controller from mobile (
app/controllers/perps/) intopackages/perps-controller/src/. After this PR merges, mobile drops its in-repo controller copy and depends on@metamask/perps-controllerfrom this repo directly. The core package becomes the source of truth.Mobile changes carried over since the previous sync (mobile commit
35953448):feat(perps): add slippage controls for market orders (mobile #30125)feat(perps): trackvip_tier/vip_discountproperties on trading events (mobile #30385)feat(perps): in-app banner during an ongoing HyperLiquid outage (mobile #30081)fix: prefer the selected EVM account when resolving the trading account (mobile #30253)fix(perps): suppressUser or API Wallet does not existSentry noise from unfunded wallets (mobile #29972)fix(perps): approve the HyperLiquid builder fee when missing (mobile #30095)Validation:
scripts/perps/validate-core-sync.shdriven from mobile (rsync, ESLint --fix + suppress, oxfmt, build, lint, tests, changelog, sync-state).yarn buildat core root producespackages/perps-controller/dist/PerpsController.{mjs,cjs}with thewebpackIgnore: truesafeguard intact for the MYX entry that extension consumers exclude viapackage.jsonfiles.References
TAT-3187-perps-controller-removal.Checklist
Note
Medium Risk
Changes touch order pricing/slippage handling and HyperLiquid trading-readiness flows (migration, builder-fee approval, referral), which can affect order submission behavior and analytics; most changes are additive with guards and fallbacks.
Overview
Adds a persisted, user-configurable max slippage preference (
maxSlippageBps) exposed via new controller actions (getMaxSlippage/setMaxSlippage), shared bounds (MAX_SLIPPAGE_BOUNDS), and order-price calculations updated to use bps (with a temporary deprecated decimalslippagefallback).Improves account resolution by preferring
AccountsController:getSelectedAccount(and subscribing toAccountsController:selectedAccountChange) so perps state/cache and signing always follow the actively selected EVM account.Hardens HyperLiquid setup to reduce noise and unblock trading: introduces a session cache/probe for whether a wallet is registered on HyperLiquid and skips/refuses to Sentry-log the benign "User or API Wallet does not exist" case; builder-fee approval is now retried after prior failures; trading analytics gains
vip_tier/vip_discountproperties (including flip-position tracking) plus new event constants (slippage/outage/status).Reviewed by Cursor Bugbot for commit 558a874. Bugbot is set up for automated code reviews on this repo. Configure here.